package Messages.OfficeRegionMessages;

import Agents.AOfficeRegion;
import Agents.Messageable;
import Messages.AMessage;
import Messages.OfficeRegionMessage;

public class AdjustToUser extends OfficeRegionMessage
{
	public Units unit;
	public int value;
	@Override
	protected String constructSpecialMessage(Messageable agent) 
	{
		String returner = super.constructSpecialMessage(agent) + agentDo;
		
		switch(((AOfficeRegion)agent).receiver)
		{
			case FLOOR_HEATER_AGENT:
				 returner = returner + Units.TEMPERATURE + doAdjust + ((AOfficeRegion)agent).preferenceTemperature;
				 break;
			default:
				 break;
		}
		
		return returner;
	}
	
	@Override
	protected void retrieveMyMessage(String theMessage) 
	{
		String[] send = theMessage.split(officeToAgent);
		sender = send[0];
		String[] res = send[1].split(agentDo);
		receiver = GlobalNames.toEnum(res[0]);
		
		String[] information = res[1].split(doAdjust);
		unit = getUnit(information[0]);
		value = Integer.parseInt(information[1]);
	}
}
